ps2frag

Section: User Commands (1)
Updated: Oct 93
Index Return to Main Contents
 

NAME

ps2frag - extract text fragments from EPSF file  

SYNOPSIS

ps2frag EPSFfile ...
 

DESCRIPTION

The program psfrag extracts the position, orientation and content of each piece of text that a particular PostScript file displays (shows) and writes them in a file with extension `.frag'. This file can be processed with LaTeX to replace the text fragments with other LaTeX text fragments. The main purpose of the program is to overcome the problems one normally has to put LaTeX text in EPSF figures made with applications that don't understand TeX fonts.

The PostScript EPSFfile might be produced, for example, by xfig, idraw, matlab, xmath, etc. Each string displayed by PostScript's show operator is a candidate for replacement by LaTeX text, math symbols, equations, pictures etc. For example, you can include a matlab plot in a LaTeX document with the title, axis labels, and legend generated by LaTeX.

The LaTeX fragments can be optionally rotated, scaled, and repositioned relative to the text being replaced. The LaTeX fragments automatically track the PostScript text position as the PostScript file is modified, or as the scaling and offsets of the \special or \epsfbox are changed.

The possibilities of the program can best be described by giving a complete example. Suppose you want to make an EPSF picture for LaTeX with your favourite drawing program containing the triangle of Pythagoras. You want to add the letter `$a$' and `$b$' to the short sides and `$\sqrt{a^2+b^2}$' to the longest side of the triangle.

1)
make the drawing (example.epsf) in which you add the letters `a', `b' and `c' instead of `$a$', `$b$' and `$\sqrt{a^2+b^2}$' with your favourite drawing tool.

2)
Run latex with next input (example.tex):

\documentstyle[epsfrag,psfrag]{article}
\begin{document}
This is a test.
\begin{figure}
  \psfrag{a}{$a$}
  \psfrag{b}{$b$}
  \psfrag{c}{$\sqrt{a^2+b^2}$}
  \epsfysize=4in
  \leavevmode\epsfbox{example.epsf}
  \caption{This is an example.}
\end{figure}
\end{document}

The epsfrag and psfrag style options provide the \psfrag macro which replaces the letters `a', `b' and `c' with the CMR math text we really want.

3)
run ps2frag on example.epsf to produce example.frag.

4)
run dvips as normal and you get the figure you wanted!

 

FILES

(Next files are available in directory ps2frag somewhere in the TeX-tree.)
epsfrag.sty
a slightly modified version of epsf.sty that supports psfrag.
psfrag.sty
LaTeX style file for overlaying PostScript text in an EPSF file (included via \epsfbox or \special) with arbitrary fragments of LaTeX.
ps2frag.ps
a PostScript file used by ps2frag to let GhostScript extract text fragments.
USAGE
Consult this file if you want to know more possibilities of the psfrag LaTeX style option.
example.*
The sources of the above mentioned example.

 

SEE ALSO

dvips(1), gs(1), latex(1), perl(1)

 

AUTHORS

Craig Barratt <craig@isl.stanford.edu>
Original package
Piet Tutelaers <rcpt@urc.tue.nl>
Some improvements and this manual page.


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILES
SEE ALSO
AUTHORS

This document was created by man2html, using the manual pages.
Time: 01:34:16 GMT, February 01, 2023